-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort spacing sizes when all slugs begin numerically #62567
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +8 B (0%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
1 | ||
) { | ||
// Using numeric slugs opts-in to sorting by slug. | ||
if ( sizes.every( ( { slug } ) => /^[0-9]/.test( slug ) ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this just checking that it starts with a number, allowing slugs like 50-medium
to be sorted, but maybe it would make more sense to only sort slugs that are completely numeric.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good
Flaky tests detected in bfcc4cf. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9510958444
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good, and works as expected in my testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me. Sorting works, and I think it's OK to continue sorting when the slug begins with the number.
Co-authored-by: ajlende <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: justintadlock <[email protected]>
Co-authored-by: ajlende <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: justintadlock <[email protected]>
Co-authored-by: ajlende <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: justintadlock <[email protected]>
I just cherry-picked this PR to the wp/6.6-beta-3 branch to get it included in the next release: 8ffc66f |
Co-authored-by: ajlende <[email protected]> Co-authored-by: scruffian <[email protected]> Co-authored-by: justintadlock <[email protected]>
What?
Changes the sorting heuristic for
spacingSizes
from having more than one origin to all slugs from all origins beginning numerically.Removes the numeric requirement for slugs in the schema.
Why?
Fixes #62520
How?
#62520 (comment)
Testing Instructions
Try numeric and non-numeric slugs with and without defaults enabled to see if sorting happens when you would expect.
Testing Instructions for Keyboard
Screenshots or screencast